<?php

/**
 * Produit filter form base class.
 *
 * @package    lointains-espace
 * @subpackage filter
 * @author     William Ong
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseProduitFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'pays_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pays'), 'add_empty' => true)),
      'nom_produit'        => new sfWidgetFormFilterInput(),
      'type_produit'       => new sfWidgetFormFilterInput(),
      'carte_geographique' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CarteGeographique'), 'add_empty' => true)),
      'image_1'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image1'), 'add_empty' => true)),
      'image_2'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image2'), 'add_empty' => true)),
      'image_3'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image3'), 'add_empty' => true)),
      'image_4'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image4'), 'add_empty' => true)),
      'image_5'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image5'), 'add_empty' => true)),
      'court_description'  => new sfWidgetFormFilterInput(),
      'moment_fort'        => new sfWidgetFormFilterInput(),
      'tarifs'             => new sfWidgetFormFilterInput(),
      'is_active'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'created_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'pays_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Pays'), 'column' => 'id')),
      'nom_produit'        => new sfValidatorPass(array('required' => false)),
      'type_produit'       => new sfValidatorPass(array('required' => false)),
      'carte_geographique' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CarteGeographique'), 'column' => 'id')),
      'image_1'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Image1'), 'column' => 'id')),
      'image_2'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Image2'), 'column' => 'id')),
      'image_3'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Image3'), 'column' => 'id')),
      'image_4'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Image4'), 'column' => 'id')),
      'image_5'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Image5'), 'column' => 'id')),
      'court_description'  => new sfValidatorPass(array('required' => false)),
      'moment_fort'        => new sfValidatorPass(array('required' => false)),
      'tarifs'             => new sfValidatorPass(array('required' => false)),
      'is_active'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'created_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('produit_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Produit';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'pays_id'            => 'ForeignKey',
      'nom_produit'        => 'Text',
      'type_produit'       => 'Text',
      'carte_geographique' => 'ForeignKey',
      'image_1'            => 'ForeignKey',
      'image_2'            => 'ForeignKey',
      'image_3'            => 'ForeignKey',
      'image_4'            => 'ForeignKey',
      'image_5'            => 'ForeignKey',
      'court_description'  => 'Text',
      'moment_fort'        => 'Text',
      'tarifs'             => 'Text',
      'is_active'          => 'Boolean',
      'created_at'         => 'Date',
      'updated_at'         => 'Date',
    );
  }
}
